using System;
using BlackboardPattern_Test.Components;
using EventManagement_Test.ApplicationEvents;
using SharpObjects.EventBus;

namespace EventManagement_Test.Components
{
    public class Component1
    {
        private IEventBus eventBus;

        public Component1()
        {
            this.eventBus = EventBusManager.EventBus;
            this.eventBus.ApplicationEvent += new ApplicationEventHandler(eventBus_ApplicationEvent1Handler);
        }

        void eventBus_ApplicationEvent1Handler(object applicationEvent)
        {
            if(applicationEvent is ApplicationEvent1)
            {
                ApplicationEvent1 applicationEvent1 = (ApplicationEvent1) applicationEvent;

                Console.WriteLine("Component1 - Received ApplicationEvent1: {0}", applicationEvent1);
            }
        }
        
    }
}